<app-content-header
  [search]="search"
  [showSearch]="ifShowSearch"
>
  <ng-template #search>
    <app-search [(data)]="searchSchema" [customItems]="customSchema" (bindSearch)="handleSearch()"></app-search>
  </ng-template>

</app-content-header>

<div class="cil-table-block">
  <st
    #st
    [scroll]="scroll"
    [data]="data"
    [columns]="columns"
    [widthMode]="widthMode"
    [ps]="ps"
    [pi]="pi"
    [page]="stPage"
    [total]="total"
    [loading]="loading"
    (change)="onChange($event)"
  >
    <ng-template st-row="type" let-item let-index="index" let-column="column">
      {{ parseType(item.rptType) }}
    </ng-template>

    <ng-template st-row="level" let-item let-index="index" let-column="column">
      {{ parseLevel(item.rptLevel)}}
    </ng-template>
  </st>
</div>

<ng-template #tplAcquirer>
  <app-aams-select
    level="institution"
    [(ngModel)]="selectedAcquirer"
    [disabled]="isAcquirerUser"
  ></app-aams-select>
</ng-template>

<ng-template #tplGroup>
  <app-aams-select
    level="agent"
    [(ngModel)]="selectedGroup"
    [insCode]="selectedAcquirer ? selectedAcquirer.code : ''"
    [disabled]="isAgentUser"
  ></app-aams-select>
</ng-template>

<ng-template #tplMerchant>
  <app-aams-select
    level="merchant"
    [(ngModel)]="selectedMerchant"
    [insCode]="selectedAcquirer ? selectedAcquirer.code : ''"
    [agentCode]="selectedGroup ? selectedGroup.code : ''"
    [disabled]="isMerchantUser"
  ></app-aams-select>
</ng-template>

<ng-template #tplStore>
  <app-aams-select
    level="store"
    [(ngModel)]="selectedStore"
    [insCode]="selectedAcquirer ? selectedAcquirer.code : ''"
    [agentCode]="selectedGroup ? selectedGroup.code : ''"
    [intMerCode]="selectedMerchant ? selectedMerchant.code : ''"
    [disabled]="isStoreUser"
  ></app-aams-select>
</ng-template>

